package com.panopset.svg2.card;

import java.awt.Color;
import java.awt.Graphics2D;

import javax.swing.JFrame;

import com.panopset.Util;
import com.panopset.sf.OsgwResizable;

public class SvgCardDemo {

    private void painter(Graphics2D g) {
        g.setColor(Color.YELLOW);
        g.fillOval(0, 0, W, H);
        getSvgCardPainter().paintCard(g, SvgCards.BLUEBACK, 20, 20, 220);
    }

    private final int W = 600;
    private final int H = 500;

    private SvgCardDemo() {
        JFrame f = new JFrame();
        f.setSize(W, H);
        f.setLocation(Util.centerInScreen(f.getSize()));
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f.add(new OsgwResizable() {

            @Override
            public void paintCycle(Graphics2D g) {
                painter(g);
            }
        }.getPanel());
        f.setVisible(true);
    }


    private SvgCardPainter svgCardPainter;

    private SvgCardPainter getSvgCardPainter() {
        if (svgCardPainter == null) {
            svgCardPainter = new SvgCardPainter();
        }
        return svgCardPainter;
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        new SvgCardDemo();
    }

}
